
#import "RIBOption.h"

@implementation RIBOption

- setName:(RtToken)newName
     n:(int)newN tokens:(RtToken *)newTokens parms:(RtPointer *)newParms archiveVector:(char **)newArchiveVector
     printfTypeVector:(int *)newPrintfTypeVector printfNVector:(int *)newPrintfNVector
{

   theName = NXCopyStringBuffer(newName);
   [self setN:newN tokens:newTokens parms:newParms archiveVector:newArchiveVector printfTypeVector:newPrintfTypeVector printfNVector:newPrintfNVector];
   return self;
}

- (const char *)theName { return theName; }

- renderSelf:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime
{
  RiOptionV(theName, n, tokens, parms);

  return self;
}

- (BOOL)theSameAs:otherRIBCommand
{
  if (strcmp(theName, [otherRIBCommand theName]))
  {  return NO;
  }
  return [super theSameAs:otherRIBCommand];
}


- writeEve:(NXStream *)stream atTabLevel:(int)tab
{
   int  i;


   for (i = 0; i < tab; i++)
   {  NXPrintf(stream, "\t");
   }
   NXPrintf(stream, "Option {%s} ", theName);
   [super writeParameterList:stream];
   return self;
}

#define typeVector "*"
#define typeValues &theName

- read:(NXTypedStream*)stream 
{
    int version;
    [super read:stream];

    version = NXTypedStreamClassVersion(stream,"RIBOption");
    if (version == 0) NXReadTypes(stream, "i", &version), version=1;
    if (version == 1)
    {  NXReadTypes(stream, typeVector, typeValues);
    } 
    else 
    {
    }
    return self;
}

- write:(NXTypedStream*)stream 
{
    [super write:stream];

    NXWriteTypes(stream, typeVector, typeValues);

    return self;
}


@end
